package com.eling.elcms.travel.model;

import com.eling.elcms.community.model.Organization;
import com.eling.elcms.core.dao.annotation.Between;
import com.eling.elcms.core.dao.annotation.CriteriaEnhancer;
import com.eling.elcms.core.dao.annotation.CriteriaEnhancers;
import com.eling.elcms.core.dao.annotation.In;
import com.eling.elcms.core.model.BaseModel;
import com.eling.elcms.privilege.service.impl.CommonPrivilegeCriteriaEnhancer;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;

import javax.persistence.*;

/**
 * 基础价格
 * @author wen
 *
 */
@Entity
@Table(name = "travel_baseprice")
@Indexed
@CriteriaEnhancers(criteriaEnhancers = {
		@CriteriaEnhancer(impl = CommonPrivilegeCriteriaEnhancer.class, parameter = "organization:organization") })
public class BasePrice extends BaseModel {


	private static final long serialVersionUID = 1107221091295189640L;

	@Id
	@In
	@DocumentId
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long pkBasePrice;
	
	/** 所属机构*/
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "pkOrganization")
    @IndexedEmbedded(depth = 1)
	private Organization organization;
	
	/**冷水费（元/立方） */
	@Column
	@Field
	@Between
	private Double water;
	
	/**热水费（元/立方） */
	@Column
	@Field
	@Between
	private Double hotWater;
	
	/** 电价(元/度) */
	@Column
	@Field
	@Between
	private Double electric;
	
	@Version
	private Integer version;

	public Long getPkBasePrice() {
		return pkBasePrice;
	}

	public void setPkBasePrice(Long pkBasePrice) {
		this.pkBasePrice = pkBasePrice;
	}

	public Organization getOrganization() {
		return organization;
	}

	public void setOrganization(Organization organization) {
		this.organization = organization;
	}

	public Double getWater() {
		return water;
	}

	public void setWater(Double water) {
		this.water = water;
	}

	public Double getHotWater() {
		return hotWater;
	}

	public void setHotWater(Double hotWater) {
		this.hotWater = hotWater;
	}

	public Double getElectric() {
		return electric;
	}

	public void setElectric(Double electric) {
		this.electric = electric;
	}

	public Integer getVersion() {
		return version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}
}
